import request from '@/utils/request';
import { IotProductQuery, IotProductForm, IotProductVO } from './types';
import { AxiosPromise } from 'axios';

// 查询设备产品列表
export function listProduct(query: IotProductQuery): AxiosPromise<IotProductVO[]> {
  return request({
    url: '/system/iot/product/list',
    method: 'get',
    params: query
  });
}

// 查询设备产品详细
export const getProduct = (productId: string | number): AxiosPromise<IotProductVO> => {
  return request({
    url: '/system/iot/product/' + productId,
    method: 'get'
  });
};

// 新增设备产品
export const addProduct = (data: IotProductForm) => {
  return request({
    url: '/system/iot/product',
    method: 'post',
    data: data
  });
};

// 修改设备产品
export const updateProduct = (data: IotProductForm) => {
  return request({
    url: '/system/iot/product',
    method: 'put',
    data: data
  });
};

// 删除设备产品
export const delProduct = (productId: string | number | Array<string | number>) => {
  return request({
    url: '/system/iot/product/' + productId,
    method: 'delete'
  });
};



// 获取字典选择框列表
export function optionselect(): AxiosPromise<SelectDataOption[]> {
  return request({
    url: '/system/iot/product/optionselect',
    method: 'get'
  });
}

